package testCalander;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;


public class TestCal {
	
	private static final Log log = LogFactory.getLog(TestCal.class);
	private static final long serialVersionUID = 5L;
	private static final int MONTHES_OF_YEAR = 5;
	private static final String SPACES_WITH_STRIKE_MIDDLE = "-";
	private static final int claimLookback = 1;
	private static final DateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd");
	
	
	@Test
	public void testC(){
		Date[] date = getBeforeDateAndEndDate();
		System.out.println("before:"+date[0]+" end"+date[1]);
	}
	
	
	
	private Date[] getBeforeDateAndEndDate() {
		log.info("getBeforeDateAndEndDate() invoked");
		Date[] beforeDateAndCurrentDate = new Date[2];
		
		Calendar beforeCal = Calendar.getInstance();
		beforeCal.add(Calendar.MONTH, -claimLookback);
		Date beforeDate = beforeCal.getTime();
		
		Calendar currentCal = Calendar.getInstance();
		Date currentDate = currentCal.getTime();
		
		beforeDateAndCurrentDate[0] = beforeDate;
		log.info("beforeDate:"+beforeDate);
		beforeDateAndCurrentDate[1] = currentDate;
		log.info("currentDate:"+currentDate);
		
		log.debug("getBeforeDateAndEndDate() complete");
		return beforeDateAndCurrentDate;
	}

}
